<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>APP</title>
		<link href="css/weui.min.css" rel="stylesheet" />
		<link href="css/jquery-weui.min.css" rel="stylesheet" />
		<link href="css/style.css" rel="stylesheet" />
		<link href="fonts/iconfont.css" rel="stylesheet" />
		<link href="css/flex.css" rel="stylesheet" />
		<script src="js/immersed.js"></script>
	</head>

	<style>
		.main-body {
			background-color: #f4f4f4;
		}
		
		.weui-cell {
			font-size: 15px;
		}
		
		.weui-label {
			width: 180px;
			color:#999
		}
	</style>

	<body>

		<div id="app">
			<form id="form" v-on:submit.prevent>

				<div class="xiaoyi-header header-red" id="header">
					<div class="xiaoyi-header-left"><i class="iconfont icon-back " onclick="wsClose()"></i></div>
					<div class="xiaoyi-header-title">价格系数</div>
					<!--<div class="xiaoyi-header-right"><span style="margin: 10px 10px 0 0 ; display: block;" @click="onSubmit">搜索</span></div>-->
				</div>

				<div class="main-body" id="main">

					<div class="weui-cells__title">价格系数设置，保底系数1.8</div>
					<div class="weui-cells weui-cells_form">
						
						<template v-for="(vo,index) in this.items">
							<div class="weui-cell">
								<div class="weui-cell__hd"><label class="weui-label">{{vo.price_lower}}~{{vo.price_highest}} 元</label></div>
								<div class="weui-cell__bd">
									<input class="weui-input" type="text" step="0.01" :name="'data['+index+'][ratio]'" placeholder="输入价格系数" :value="vo.ratio">
									<input type="hidden" :name="'data['+index+'][price_lower]'" :value="vo.price_lower">
									<input type="hidden" :name="'data['+index+'][price_highest]'" :value="vo.price_highest">
								</div>
							</div>
						</template> 
						
						
					</div>
					

					
					<div class="weui-btn-area">
						<button type="submit" @click="onSubmit" class="weui-btn weui-btn_primary">提 交</button>
					</div>

				</div>

			</form>
		</div>

		<script src="js/mui.min.js"></script>
		<script src="js/jquery-2.1.4.js"></script>
		<script src="js/jquery-weui.min.js"></script>
		<script src="js/vue.js"></script>
		<script src="js/smarge.js"></script>
		<script src="js/common.js"></script>
		<script type="text/javascript" charset="utf-8">
			mui.init();

			mui.plusReady(function() {
				
				
				var vm = new Vue({
					el: "#app",
					data: {
						items:[],
						userinfo:getUserInfo()
					},
					mounted: function() {
						this.inits()
					},
					methods: {
						inits: function() {
							var vm = this;
							plus.nativeUI.showWaiting()
							Get(SERVER_URL+'&c=Shop&a=getRatio',{},function(data){ 
								if(data.status){
									vm.items=data.info;
									plus.nativeUI.closeWaiting() 
								}else{
									mui.alert(data.info); 
									plus.nativeUI.closeWaiting();
								}
							})
						},
						onSubmit: function() { 
							var _data = fromToJson("form"); 
							plus.nativeUI.showWaiting()
							Post(SERVER_URL+"&c=Shop&a=saveSetPrice",_data,function(data){ 
									if(data.status){
										plus.nativeUI.closeWaiting();
										mui.toast(data.info)
									}else{
										plus.nativeUI.closeWaiting(); 
										mui.alert(data.info)
									}
							})
						}
					}
				});
				
			});

			
		</script>
	</body>

</html>